package com.Touch.TouchSimulator
{
	
	public class SimulateTouchObj
	{
		private var touchid:int;
		
		private var exist:Boolean;
		
		private var moved:Boolean;
		
		private var x:int;
		
		private var y:int;
		
		private var w:int;
		
		private var h:int;
		
		public function SimulateTouchObj(_id:int,_x:int,_y:int,_w:int,_h:int)
		{
			super();

			exist=true;
			moved=true;
			
			x=_x;
			y=_y;
			w=_w;
			h=_h;
			touchid=_id;
		}
		
		public function updata(_x:int,_y:int):void{
			moved=true;
			x=_x;
			y=_y;
		}
		
		public function remove(_x:int,_y:int):void{
			exist=false;
			moved=true;
			x=_x;
			y=_y;
		}
		
		public function get touchID():int{
			return touchid;
		}
	
		public function get isExist():Boolean{
			return exist;
		}
		
		public function get isMoved():Boolean{
			return moved;
		}
		
		public function outputxml():XML{
			moved=false;
			var tx:String=(x/w).toFixed(4);
			var ty:String=(y/h).toFixed(4);
			return new XML(<obj><id>{touchid}</id><state>{exist.toString()}</state><x>{tx}</x><y>{ty}</y></obj>);
		}
	}
}